import request from '@/utils/request'

export function getLedger(data) {
  return request({
    url: '/accbook/ledger/datatables',
    method: 'post',
    data
  })
}

export function printLedger(data) {
  return request({
    url: '/accbook/printLedger',
    method: 'post',
    data
  })
}

export function exportLedger(data) {
  var exportUrl = 'accbook/exportLedger'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getProjbalance(data) {
  return request({
    url: '/accbook/projbalance/datatables',
    method: 'post',
    data
  })
}

export function printProjbalance(data) {
  return request({
    url: '/accbook/printProjBalance',
    method: 'post',
    data
  })
}

export function exportProjbalance(data) {
  var exportUrl = 'accbook/exportProjBalance'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getDetail(data) {
  return request({
    url: '/accbook/subsidiary/datatables',
    method: 'post',
    data
  })
}

export function printSubsidiary(data) {
  return request({
    url: '/accbook/printSubsidiary',
    method: 'post',
    data
  })
}

export function exportSubsidiary(data) {
  var exportUrl = 'accbook/exportSubsidiary'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getSubsidiary(data) {
  return request({
    url: '/accbook/subsidiary/datatables',
    method: 'post',
    data
  })
}

export function getBalance(data) {
  return request({
    url: '/accbook/balance/datatables',
    method: 'post',
    data
  })
}

export function printBalance(data) {
  return request({
    url: '/accbook/printBalance',
    method: 'post',
    data
  })
}

export function exportBalance(data) {
  var exportUrl = 'accbook/exportBalance'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getMultisubsidiary(data) {
  return request({
    url: '/accbook/multisubsidiary/datatables',
    method: 'post',
    data
  })
}

export function printMultisubsidiary(data) {
  return request({
    url: '/accbook/printMultisubsidiary',
    method: 'post',
    data
  })
}

export function exportMultisubsidiary(data) {
  var exportUrl = 'accbook/exportMultisubsidiary'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getSubsidiarynum(data) {
  return request({
    url: '/accbook/subsidiaryQty/datatables',
    method: 'post',
    data
  })
}

export function printSubsidiaryNum(data) {
  return request({
    url: '/accbook/printSubsidiaryQty',
    method: 'post',
    data
  })
}

export function exportSubsidiaryNum(data) {
  var exportUrl = 'accbook/exportSubsidiaryQty'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getLedgernum(data) {
  return request({
    url: '/accbook/ledgerQty/datatables',
    method: 'post',
    data
  })
}

export function printLedgernum(data) {
  return request({
    url: '/accbook/printLedgerQty',
    method: 'post',
    data
  })
}

export function exportLedgernum(data) {
  var exportUrl = 'accbook/exportLedgerQty'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getProjsubsidiary(data) {
  return request({
    url: '/accbook/projSubsidiary/datatables',
    method: 'post',
    data
  })
}

export function printProjsubsidiary(data) {
  return request({
    url: '/accbook/printProjSubsidiary',
    method: 'post',
    data
  })
}

export function exportProjsubsidiary(data) {
  var exportUrl = 'accbook/exportProjSubsidiary'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getVoucherTotal(data) {
  return request({
    url: '/accbook/voucher/datatables',
    method: 'post',
    data
  })
}

export function printVoucherTotal(data) {
  return request({
    url: '/accbook/printVoucherTotal',
    method: 'post',
    data
  })
}

export function exportVoucherTotal(data) {
  var exportUrl = 'accbook/exportVoucherTotal'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getCatogery() {
  return request({
    url: '/gl/catogery/list',
    method: 'post'
  })
}

export function getItemLedger(data) {
  return request({
    url: '/ia/balance/ledgerList',
    method: 'post',
    data
  })
}

export function prinItemtLedger(data) {
  return request({
    url: '/ia/balance/printLedger',
    method: 'post',
    data
  })
}

export function exportItemLedger(data) {
  var exportUrl = 'ia/balance/exportLedger'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}

export function getItemSubsidiary(data) {
  return request({
    url: 'ia/balance/subsidiaryList',
    method: 'post',
    data
  })
}

export function printItemSubsidiary(data) {
  return request({
    url: 'ia/balance/printSubsidiary',
    method: 'post',
    data
  })
}

export function exportItemSubsidiary(data) {
  var exportUrl = 'ia/balance/exportSubsidiary'
  var temp = document.createElement('form')
  temp.action = exportUrl
  temp.method = 'POST'
  temp.style.display = 'none'
  for (var x in data) {
    var opt = document.createElement('textarea')
    opt.name = x
    opt.value = data[x]
    temp.appendChild(opt)
  }
  document.body.appendChild(temp)
  temp.submit()
  return temp
}
